﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace Clock
{
	class Program
	{
		static void Main(string[] args)
		{
			int H = -1;
			while (H < 0 || H > 23)
			{
				Console.WriteLine("Please enter hours in format from 0 to 23");
				H = int.Parse(Console.ReadLine());
			}

			int M = -1;
			while (M < 0 || M > 59)
			{
				Console.WriteLine("Please enter minutes in format from 1 to 59");
				M = int.Parse(Console.ReadLine());
			}

			int S = -1;
			while (S < 0 || S > 59)
			{
				Console.WriteLine("Please enter seconds in format from 1 to 59");
				S = int.Parse(Console.ReadLine());
			}

			while (true)
			{
				Console.Clear();
				Console.WriteLine("{0:00}:{1:00}:{2:00}", H, M, S);
				Thread.Sleep(1000);
				S++;
				if (S > 59)
				{
					S = 0;
					M++;
					if (M > 59)
					{
						M = 0;
						H++;
						if (H > 23)
						{
							H = 0;
						}
						//string =(sec<10?"0":""+) +sec; условный оператор
					// ?: 
					// 
					}
				}
			}
		}
	}
}